@mixin theme-card-border($color) {
  border-color: var(--#{$color}-medium);
  box-shadow: 0 0 0 3px var(--#{$color}-low);
}

.themes-cards-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1em;
  align-items: stretch;
  margin-top: var(--space-4);
}

.theme-card {
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 0 0 3px transparent;
  transition: box-shadow 0.3s ease-in-out;
  height: 100%;

  &.--updating {
    animation:
      updating 3s ease-in-out 1,
      updatingInfinite 3s ease-in-out 3s infinite;

    @keyframes updating {
      0% {
        box-shadow: 0 0 0 3px transparent;
        border: 1px solid var(--success);
      }

      50% {
        box-shadow: 0 0 0 6px var(--success-low);
        border: 1px solid var(--success);
      }

      100% {
        box-shadow: 0 0 0 3px var(--success-low);
        border: 1px solid var(--success);
      }
    }

    @keyframes updatingInfinite {
      0% {
        box-shadow: 0 0 0 3px var(--success-low);
        border: 1px solid var(--success);
      }

      50% {
        box-shadow: 0 0 0 6px var(--success-low);
        border: 1px solid var(--success);
      }

      100% {
        box-shadow: 0 0 0 3px var(--success-low);
        border: 1px solid var(--success);
      }
    }
  }

  &.--updating .d-icon-arrows-rotate {
    animation: rotate 3s linear infinite;
    margin-right: 0.45em;

    @keyframes rotate {
      0% {
        transform: rotate(0deg);
      }

      100% {
        transform: rotate(360deg);
      }
    }
  }

  .admin-config-area-card__content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
  }

  &.--default {
    @include theme-card-border(tertiary);
  }

  &__icons {
    display: flex;
  }

  &__image-wrapper {
    width: 100%;
    height: 160px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--content-border-color);
    border-top-left-radius: var(--d-border-radius);
    border-top-right-radius: var(--d-border-radius);

    svg {
      width: 100%;
      top: 0;
      left: 0;
    }
  }

  &__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top left;
  }

  .ember-checkbox {
    margin: 0 5px 0 0;
  }

  &__checkbox-label {
    margin: 0;
    font-weight: 400;
  }

  &__content {
    padding-inline: 1rem;
    padding-top: 1rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
  }

  &__title {
    font-size: var(--font-up-0);
    font-weight: 700;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    overflow-wrap: anywhere;
  }

  &__description {
    margin: 0 0 10px 0;
  }

  &__components {
    display: -webkit-box;
    font-size: var(--font-down-1);
    color: var(--primary-high);
    -webkit-box-orient: vertical;
    overflow: hidden;
    -webkit-line-clamp: 3;
  }

  &__install-button {
    margin-top: auto;
  }

  &__button.--set-default {
    position: absolute;
    top: 4px;
    right: 4px;
  }

  &__footer {
    flex-direction: column;
    padding-inline: 1rem;
    padding-bottom: 1rem;
  }

  &__controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
  }

  &__footer-actions {
    margin-left: auto;
  }

  &__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: flex-start;
    min-height: 2rem;
  }

  &__badge {
    font-size: var(--font-down-2);
    padding: 0.15rem 0.3rem;
    border-radius: 4px;
    color: var(--primary-very-high);
    background: var(--tertiary-low);
    letter-spacing: 0.25px;
    align-items: center;
    display: inline-flex;
    gap: 0.25rem;

    svg {
      height: 0.75em;
      color: var(--primary-high);
    }

    &.--default {
      background-color: var(--tertiary);
      color: var(--secondary);
      position: absolute;
      right: 8px;
      top: 8px;
      font-size: var(--font-down-3);
      text-transform: uppercase;
    }
  }

  .admin-config-area-card__header-action {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--secondary);
    right: 20px;
    top: 22px;
  }
}

.admin-config-area-card.theme-card
  .admin-config-area-card__content
  .external-resources {
  display: flex;
  justify-content: space-between;
  flex-direction: column;
  font-size: var(--font-down-1);
  margin-bottom: 10px;

  .external-link {
    margin-bottom: 0.25em;
    color: var(--primary);
    text-decoration: underline;
  }
}

.admin-config-area-card.theme-card {
  padding: 0;
  height: 100%;
  display: flex;
  flex-direction: column;

  .admin-config-area-card__content {
    margin: 0;
    padding-right: 0;
  }

  .admin-config-area-card__header-wrapper {
    flex: none;
  }
}

.admin-config-area-card.theme-install-card {
  .theme-install-card__external-links {
    svg {
      font-size: var(--font-down-3);
      margin-bottom: 0.1em;
    }
  }
}
